#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main1()
{
    int n;
    cin >> n;
    vector<vector<int>> v(n);
   
    for (int i = 0; i < n; i++) {
        v[i].resize(3);
        for (int j = 0; j < 3; j++) {
            scanf("%d", &v[i][j]);
        }
    }

    int i = 0;
    vector<int> v1;
    while (n) {
        int sum = 0;
        int x = min(min(v[i][0], v[i][1]), min(v[i][1], v[i][2]));
        sum += x * 2;

        if ((v[i][1] - x) != 0) {
            sum += v[i][1] - 1;
        }
        i++;
        n--;
        v1.push_back(sum);
    }

    for (auto e : v1) {
        cout << e << endl;
    }

	return 0;
}


void Test1()
{
    int n;
    cin >> n;
    while (n)
    {
        int sum = 0, a, b, c;
        cin >> a >> b >> c;
        int x = min(min(a, b), min(b, c));
        sum += x * 2;
        if (x != b)
        {
            sum += (b - x) - 1;
        }
        cout << sum << endl;
        n--;
    }
}

void Test2()
{

}


int LastRemaining_Solution(int n, int m) {
    if (n <= 0 || m <= 0) return -1;
    int back = 0;
    for (int i = 2; i <= n; i++)
    {
        back = (back + m) % i;
    }

    return back;
}

int main()
{


    return 0;
}